<?php
/**
 * 上传Excel接口
 * @Description: 上传Excel
 * @param \Excel FILE
 * @param type 接口类型
 * @return void
 */
require './src/Spout/Autoloader/autoload.php';
require './init.php';
require './Sheet.php';

use app\Sheet;

use Box\Spout\Reader\ReaderFactory;
use Box\Spout\Common\Type;


move_uploaded_file($_FILES['upload-hide1']["tmp_name"],"./upload/" . 'excel1.xlsx');
// 将Excel中的数据保存到数据库

// 接收上传的Excel
$filePath = './upload/' . 'excel1.xlsx';

// 创建阅读器
$objReader = ReaderFactory::create(Type::XLSX);
$sheetModel = new Sheet;
$sheetModel->insertDb($filePath,$objReader);

ajax_success(['code'	=>		'1000']);

